<!--催办  -->
<template>
  <div class="createMsg-dialog">
    <el-dialog
      title="催办"
      :visible.sync="createMsgDialogShow"
      width="628px"
      :before-close="handleClose"
      :close-on-click-modal="false"
      custom-class="dialog-box"
    >
      <el-form
        :model="ruleForm"
        :rules="rules"
        ref="ruleForm"
        label-width="80px"
      >
        <el-form-item label="催办通知" prop="info">
          <el-input
            type="textarea"
            v-model="ruleForm.info"
            maxlength="200"
            show-word-limit
            rows="4"
            style="width: 100%;"
          ></el-input>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="handleClose">取 消</el-button>
        <el-button type="primary" @click="submitForm">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import { createMsg } from "@/api/manage/manage";
export default {
  name: "createMsgDialog",
  props: {
    createMsgDialogShow: {
      type: Boolean,
      default: "",
    },
    proid: {
      type: String,
      default: "",
    },
    auditData: {
      type: Object,
      default: () => {},
    },
  },
  inject:['reload'],
  data() { 
    return {
      rules: {
        info: [
          { required: true, message: "请输入催办通知", trigger: "blur" },
        ],
      },
      ruleForm: {
        info: "",
      },
    };
  },
  watch: {
    createMsgDialogShow(val) {
      if (val == true) {
        this.ruleForm.info = this.auditData.name + '的验收结果未备案，请您尽快完成备案。'
      }
    },
  },
  methods: {
    /** 取消按钮 */
    handleClose() {
      this.$refs.ruleForm.resetFields();
      this.$emit("changeShowDialog", "false"); //调用父组件的自定义事件，并传值
    },
    /** 确定按钮 */
    submitForm() {
      const proId = this.proid;
      this.$refs.ruleForm.validate((valid) => {
        if (valid) {
          createMsg(proId,this.ruleForm).then((res) => {
            if (res.code === 200) {
              this.$message.success(res.msg)
              this.$refs.ruleForm.resetFields();
              this.$emit("changeShowDialog", "false");
              this.reload()
            }
          });
        }
      });
    },
  },
};
</script>

<style lang="scss" >
.argument-dialog .el-form-item .el-input__inner {
  width: 100%;
}
.argument-dialog .el-form-item .el-textarea__inner {
  width: 100%;
}
.argument-dialog{
  // 下载模板样式修改
  .select-template {
    .el-dropdown-link{
      color: #3171ee;
    }
    .icon-arrow-down{
      margin-left: 10px;
      color: #3171ee;
    }
    // width: 100%;
    display: flex;
    align-items: center;
    justify-content: right;
    font-size: 14px;
    font-family: PingFang SC, PingFang SC-Regular;
    font-weight: 400;
    text-align: LEFT;
    color: #3171ee;
    margin-left: 30%;
    margin-bottom: 20px;
    cursor: pointer;
    img {
      margin-left: 10px;
    }
  }
    // 文件上传
  .upload-demo {
    .el-upload-list {
      display: none;
    }
    .el-upload {
      display: flex;
      .el-input__inner{
        width: 100%;
      }
    }
    .img-box {
      height: 37px;
      width: 36px;
      line-height: 36px;
      background: #0d72ff;
      text-align: center;
      border-radius: 0px 4px 4px 0px;
      position: absolute;
      right: -1%;
      top: 1px;
      img {
        width: 16px;
        height: 16px;
      }
    }
  }
}
</style>